import App from './App'

import http from '@/common/request.js'
Vue.prototype.$http = http;


// 文件地址
import config from '@/common/config.js'
Vue.prototype.imgUrl = config.imgUrl
Vue.prototype.staticUrl = config.staticUrl
Vue.prototype.echatUrl = config.echatUrl
Vue.prototype.palyUrl = config.palyUrl

//  常用api
import common from '@/common/common.js'
Vue.prototype.$common = common
Vue.prototype.$back = common.back
Vue.prototype.call = common.call
Vue.prototype.tel = common.tel
Vue.prototype.toUrl = common.toUrl
Vue.prototype.rectTo = common.rectTo
Vue.prototype.$pageHome = common.pageHome
Vue.prototype.$pageTab = common.pageTab
Vue.prototype.$BarTitle = common.BarTitle
Vue.prototype.$previewImage_num = common.previewImage_num
Vue.prototype.$ImageNum = common.ImageNum


import pop from '@/common/pop.js'
Vue.prototype.$pop = pop;
Vue.prototype.$showToastTxt = pop.showToastTxt;
Vue.prototype.$Toast = pop.showToastTxt;
Vue.prototype.$showLoading = pop.showLoading;
Vue.prototype.$hideLoading = pop.hideLoading;
Vue.prototype.$Modal = pop.model;
Vue.prototype.$imgUrls = pop.imgUrls;
Vue.prototype.$staticImg = pop.staticImg;
Vue.prototype.$tabbar = pop.tabbar;
Vue.prototype.$pageRela = pop.pageRela;
Vue.prototype.$getViewInfo = pop.getViewInfo;
Vue.prototype.$pageScrollTo = pop.pageScrollTo;
Vue.prototype.$openLocation = pop.openLocation;
Vue.prototype.$bannelPage = pop.bannelPage;
Vue.prototype.$PageUrl = pop.PageUrl;
Vue.prototype.$Details = pop.Details;

import reg from '@/common/reg.js'
Vue.prototype.$reg = reg;

import uView from "uview-ui";
Vue.use(uView);

import store from '@/store/index.js'
Vue.prototype.$store = store




// #ifdef H5
import jweixin from 'jweixin-module'

function H5Share(param, share_obj) {
	http.get({
		url: '/zzj_singleSaleApi/getJssdkConfig',
	}).then(res => {
		if (!res) return;
		jweixin.config({
			debug: false, // 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来，若要查看传入的参数，可以在 pc 端打开，参数信息会通过 log 打出，仅在 pc 端时才会打印。
			appId: res.appId, // 必填，公众号的唯一标识
			timestamp: res.timestamp, // 必填，生成签名的时间戳
			nonceStr: res.nonceStr, // 必填，生成签名的随机串
			signature: res.signature, // 必填，签名
			jsApiList: res.jsApiList // 必填，需要使用的 JS 接口列表
		})

		let shareData = {};
		
		if (share_obj) shareData = share_obj;
		jweixin.ready(function() {
			var obj = {
				title: shareData.title ? shareData.title : store.state.share.title,
				desc: shareData.desc ? shareData.desc : store.state.share.desc,
				link: 'http://sra.mogoie.com/index.php/singleSaleShop/index/veriCode/' + store.state
					.bid + '/reset/1?' + param,
				imgUrl: shareData.imageUrl ? config.imgUrl + shareData.imageUrl : store.state.share
					.imageUrl
			}
			// 分享到朋友圈
			jweixin.updateAppMessageShareData(obj);
			jweixin.updateTimelineShareData(obj);
		})

	})
}
Vue.prototype.$H5Share = H5Share;
// #endif
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	store,
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif